<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>在线测试--登录</title>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body >

	<div class="maindiv">
    <div class="message">在线答题--登录</div>
    <div id="darkbannerwrap"></div>
    
    <form action="#" method="post" onsubmit="return login()">
		<input name="uid" placeholder="请输入学号" required="" type="text">
		<hr class="hr15">
		<input name="uname" placeholder="请输入姓名" required="" type="text">
		<hr class="hr15">
		<input value="登录" class="btn" type="submit">
		<hr class="hr20">
	</form>
	<div id="message"></div>
	
</div>
</body>
<script type="text/javascript">
	//登录方法
	function login(){
		//异步请求后台验证
		$.post(
			"UserInfo?type=login",
			$("form").serialize(),
			function(data){
				if(data.message==="登录成功"){
					if(data.user.status=="tea"){//教师登录成绩查询页面
						window.location.href="html/marksFind.html";
					}else if(data.user.status=="stu"){//学生登录科目选择页面
						window.location.href="html/main.html";
					}
					else if(data.user.status=="admin"){//学生登录科目选择页面
						window.location.href="index.jsp";
					}
				}else{//登录失败提示信息
					$("#message").html(data.message);
				}
			},
			"json"
		);
		return false;
	}
</script>
</html>